package cn.zyl.demo.common.boot.tools;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.reflect.MethodSignature;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;

/** AnnotationTool工具类说明: 注解工具类
 * @author wsz
 * @date 2020-08-04
 * @version v1.0
 */
public class AnnotationTool {
    private AnnotationTool(){throw new IllegalAccessError("AnnotationTool");}
    public static <T extends Annotation> T getAnnotation(ProceedingJoinPoint point, Class<T> t){
        MethodSignature sign =  (MethodSignature)point.getSignature();
        Method method = sign.getMethod();
        return method.getAnnotation(t);
    }
}